<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
<script>
var str='aaaabbbwdfgeds';
var arr=str.split('');
var brr=[];
for(var i=0;i<arr.length;i++){
    if(brr.indexOf(arr[i])==-1){
        brr.push(arr[i])
    }
}
var json={};
for(var i=0;i<brr.length;i++){
    var num=0;
    for(var j=0;j<arr.length;j++){
        if(brr[i]===arr[j]){
            num++;
        }
    }
    json[brr[i]]=num;
}
console.log('统计的各个字符的个数：'+json)
console.log('去重之后的字符：'+json)
</script>  
</body>
</html>